var async = require("async");
var renderEngin = require("../common/renderEngin");
var Tools = require("../common/tools");
exports.order_manageinfo = function(req, res) {
    use(["public/javascripts/order_manageinfo/init.js", "public/javascripts/service/order_manageinfoService.js"], function(PageComponent, order_manageinfoService) {
        var storage = {};
        storage["slider"] = Tools.getPageSliderData("user_center");
        storage['oid'] = req.query.oid || '';

        order_manageinfoService.getOrderInfo({
            headers: req.headers,
            seatParams: {'orderNo': req.query.oid}
        }, function (result) {
            if (result.errorCode === 0) {
                storage["info"] = result.data;
                if(result.data.fetchAddress && result.data.fetchAddress.id){
                    storage["hasReceived"] = result.data;    //是否包含揽收
                }
                storage["status"] = result.data.orderStatus || 'DRAFT';
                PageComponent = React.createFactory(PageComponent);
                renderEngin.call(res, 'order_manageinfo', PageComponent, storage);
            }
        });
    });
}
